﻿using Com.OpenCode.Framework.Core;
using DevExpress.XtraBars.Ribbon;

namespace Com.OpenCode.Framework.DevForm
{
    /// <summary>
    ///     RibbonTab标签
    /// </summary>
    public class RibbonPageUI : RibbonPage, IMenuVisible
    {
        #region 构造函数

        public RibbonPageUI(BuildItemEventArgs args)
        {
            args.Plugin.Owner = this;
            Text = args.Plugin.Properties.Get("Text").ToString();
            (args.Owner as RibbonUI).Pages.Add(this);
        }

        #endregion

        public void CheckVisible()
        {
            bool vislble = false;
            for (int i = 0; i < Groups.Count; i++)
            {
                (Groups[i] as IMenuVisible).CheckVisible();
                if (Groups[i].Visible)
                {
                    vislble = true;
                }
            }
            Visible = vislble;
        }
    }
}